package NewTablePanels;

import javax.swing.*;

public class NewPassengerTable extends JPanel {

	private JPanel leftPart;
	private JPanel rightPart;
	
	private JLabel firstNameLabel;
	private JLabel lastNameLabel;
	private JLabel birthDateLabel;
	private JLabel addressLabel;
	private JLabel nationalityLabel;
	private JLabel passengerIDLabel;
	
	private JTextField firstNameField;
	private JTextField lastNameField;
	private JTextField birthDateField;
	private JTextField addressField;
	private JTextField nationalityField;
	private JTextField passengerIDField;
	
	public NewPassengerTable()
	{
		firstNameLabel = new JLabel("First Name: ");
		lastNameLabel = new JLabel("Last Name: ");
		birthDateLabel = new JLabel("Birthdate: ");
		addressLabel = new JLabel("Address: ");
		nationalityLabel = new JLabel("Nationality: ");
		passengerIDLabel = new JLabel("Passenger-ID: ");
		
		firstNameField = new JTextField(20);
		lastNameField = new JTextField(20);
		birthDateField = new JTextField(20);
		addressField = new JTextField(20);
		nationalityField = new JTextField(20);
		passengerIDField = new JTextField(20);
		
		leftPart = new JPanel();
		rightPart = new JPanel();
		
		leftPart.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
		rightPart.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
		
		fillLeftPart();
		fillRightPart();
		
		this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
		this.add(leftPart);
		this.add(rightPart);
		this.setVisible(false);
	}
	
	private void fillLeftPart()
	{
		leftPart.add(firstNameLabel);
		leftPart.add(lastNameLabel);
		leftPart.add(birthDateLabel);
		leftPart.add(addressLabel);
		leftPart.add(nationalityLabel);
		leftPart.add(passengerIDLabel);
	}
	
	private void fillRightPart()
	{
		rightPart.add(firstNameField);
		rightPart.add(lastNameField);
		rightPart.add(birthDateField);
		rightPart.add(addressField);
		rightPart.add(nationalityField);
		rightPart.add(passengerIDField);
	}
}
